import React from 'react'
import { Switch, Route } from 'react-router'
import D3 from './d3/index'
import Welcome from './welcome'
import Router from './menu'


const pages = [
  {
    url: '/d3',
    component: D3,
    name: '认识D3'
  }
]

export function Pages() {
  return (<Switch>
    {pages.map((item) => (
      <Route key={item.url} path={item.url} component={item.component} />
    ))}
    <Route component={Welcome}/>
  </Switch>)
}

export function Menus() {
  return (
    <Router menus={pages} />
  )
}